﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter6.Section3
{
    public class Example04
    {
        public Example04()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double> f
                = new V.Function.ToLastType<double[], double>(func);
            double[] from = { 1.0, 1.0, 1.0 };
            double[] to = { 2.0, 2.0, 2.0 };
            V.IntegrationMultiD obj = new V.IntegrationMultiD(f, from, to);
            obj.Compute();
            result += obj.BestEstimation.ToString() + "\r\n";
            obj.NumberOfCall = 1000000;
            obj.Compute();
            result += obj.BestEstimation.ToString() + "\r\n";
            double ans = 15.0/4.0*(Math.E*Math.E - Math.E);
            result += ans.ToString() + "\r\n";
        }
        private double func(double[] x)
        {
            return (1.0+x[0])*Math.Exp(x[2])*x[1];
        }
    }
}
/* 
17.5156291826366
17.5153777888781
17.5154035142685
*/

